package com.xpgk.mvc.bpropaganda;

import java.util.List;

import com.jfinal.aop.Before;
import com.jfinal.plugin.activerecord.tx.Tx;
import com.xpgk.dto.RenderBean;
import com.xpgk.mvc.base.BaseController;
import com.xpgk.mvc.bentryRegister.Customer;
import com.xpgk.mvc.brefund.ProductReturn;
import com.xpgk.mvc.intoPersonnel.IntoExperience;
import com.xpgk.mvc.productOutin.ProductOutin;
import com.xpgk.mvc.propgandaThings.PropgandaThings;
import com.xpgk.mvc.propgandaThings.PropgandaThingsValidator;


public class BpropagandaTrainingController extends  BaseController{
	

	public  void   index()
	{
		render("BpropagandaTraining.html");
	}
	private BpropagandaTrainingService bpropagandaTrainingService = new BpropagandaTrainingService();
	/**
	 * 保存基本信息
	 * */

	@Before(PropgandaValidator.class)
	public void savePro(){
		
		//获取当前登录机构id
		String  cudid=getCUserOrganIds();
		Bpropaganda bpropaganda= getModel(Bpropaganda.class,"bpropaganda");
		System.out.println(bpropaganda.toString());
		RenderBean result=bpropagandaTrainingService.savePro(bpropaganda,cudid,getCUserIds());
		renderJson(result.getMap());
	}
	
	
	/**宣传品出库
	 * 
	 */
	@Before(Tx.class)
	public  void  outGoods()
	{
		
		String  cudid=getCUserOrganIds();
		List<PropagandaThingsOut> ieList = getModels(PropagandaThingsOut.class); 
		
		String msg=bpropagandaTrainingService.saveOutGoods(ieList, cudid);
		renderText(msg);

		
	}
}
